package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author EllieHy
 * @since 2024-06-01
 */
@RestController
@RequestMapping("/admin/questions")
@RequiredArgsConstructor
@Slf4j
@Api("互动问题管理端相关接口")
public class InteractionQuestionAdminController {
	
	private final IInteractionQuestionService questionService;
	
	@ApiOperation("管理端分页查询互动问题")
	@GetMapping("page")
	public PageDTO<QuestionAdminVO> queryQuestionAdminVoPage(QuestionAdminPageQuery query) {
		return questionService.queryQuestionAdminVoPage(query);
	}
	@ApiOperation("管理端根据id查询互动问题")
	@GetMapping("{id}")
	public QuestionAdminVO queryQuestionByIdAdmin(@PathVariable("id") Long id){
		return questionService.queryQuestionByIdAdmin(id);
	}
	
	@ApiOperation("隐藏或显示问题")
	@PutMapping("/{id}/hidden/{hidden}")
	public void hiddenQuestion(
			@ApiParam(value = "问题id", example = "1") @PathVariable("id") Long id,
			@ApiParam(value = "是否隐藏，true/false", example = "true") @PathVariable("hidden") Boolean hidden
	){
		questionService.hiddenQuestion(id, hidden);
	}
	
}
